<?php

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}


  class table_common_phone extends discuz_table {

	public function __construct() {
		$this->_table = 'common_phone';
		$this->_pk = 'id';

		parent::__construct();
	}
    
    public function fetch_count() {
		
		return DB::fetch_first('SELECT count(*) as num FROM %t WHERE uid!=%s', array($this->_table,null));
	}

	public function fetch_phone($phone,$uid) {
		
		return DB::fetch_first('SELECT phone FROM %t WHERE phone=%s OR uid=%s', array($this->_table, $phone,$uid));
	}
	
	public function fetch_uid($uid) {
		
		return DB::fetch_first('SELECT uid FROM %t WHERE uid=%s', array($this->_table, $uid));
	}

	public function fetch_all() {
		
		return DB::fetch_all('SELECT uid,phone,name FROM %t ', array($this->_table));
	}
   
   public function updata( $data,$val) {
         
		return DB::update($this->_table ,$data,$val);
   }
   
   public function insert( $data) {
         
		return DB::insert($this->_table ,$data);
   }


}